package com.gwt.client.ui;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.Widget;
import com.gwt.client.event.SlideTransitionEvent;

public class Slide3 extends Composite implements Slide{

	private static final Binder binder = GWT.create(Binder.class);

	interface Binder extends UiBinder<Widget, Slide3> {/***/}
	
	private Slide.Presenter listener;
	private EventBus eventBus;

	@UiField FocusPanel slide;

	public Slide3(EventBus eventBus) {
		this.eventBus = eventBus;
		initWidget(binder.createAndBindUi(this));
	}
	
	@Override
	protected void onLoad() {
		slide.setFocus(true);
	}

	@Override
	public void setPresenter(Slide.Presenter listener){
		this.listener = listener;
	}
	
	@UiHandler("slide")
	public void keyPress(KeyDownEvent e){
		eventBus.fireEvent(new SlideTransitionEvent(e));
	}

}
